﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GeoFly
{
    public partial class ClimateFileSettingsDialog : Form
    {
        public ClimateFileSettingsDialog()
        {
            InitializeComponent();
        }

        private void button11_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void textBox8_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox12_TextChanged(object sender, EventArgs e)
        {

        }

        private void button10_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("保存参数吗？", "", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
                return;

            //数据文件
            HydroSimulate.g_ClimatePara.PcpInfo.DataFileName = this.textBox_pcp.Text;
            HydroSimulate.g_ClimatePara.TempmxInfo.DataFileName = this.textBox_Tempmx.Text;
            HydroSimulate.g_ClimatePara.TempmnInfo.DataFileName = this.textBox_Tempmn.Text;
            HydroSimulate.g_ClimatePara.TempmeanInfo.DataFileName = this.textBox_Tempmean.Text;
            HydroSimulate.g_ClimatePara.SlrInfo.DataFileName = this.textBox_Solar.Text;
            HydroSimulate.g_ClimatePara.HmdInfo.DataFileName = this.textBox_Hmd.Text;
            HydroSimulate.g_ClimatePara.WndInfo.DataFileName = this.textBox_Wnd.Text;
            HydroSimulate.g_ClimatePara.PetInfo.DataFileName = this.textBox_Pet.Text;
            //站点文件
            HydroSimulate.g_ClimatePara.PcpInfo.StationFileName = this.textBox1_Pcp_station.Text;
            HydroSimulate.g_ClimatePara.TempmxInfo.StationFileName = this.textBox_Temp_Station.Text;
            HydroSimulate.g_ClimatePara.SlrInfo.StationFileName = this.textBox_Solar_station.Text;
            HydroSimulate.g_ClimatePara.HmdInfo.StationFileName = this.textBox_Hmd_station.Text;
            HydroSimulate.g_ClimatePara.WndInfo.StationFileName = this.textBox_Wnd_station.Text;
            HydroSimulate.g_ClimatePara.PetInfo.StationFileName = this.textBox_Pet_station.Text;
            //保存以上运行参数
            HydroSimulate.g_ClimatePara.WriteClimateFile(HydroSimulate.path + "\\SysPara\\Climate.txt");

        }

        private void button1_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择降水数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_pcp.Text = openDlg.FileName;
            }
        }

        private void button9_Click(object sender, EventArgs e)
        {
            openDlg.Title="选择最高气温数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Tempmx.Text = openDlg.FileName;
            }
        }

        private void button8_Click(object sender, EventArgs e)
        {
            openDlg.Title="选择最低气温数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Tempmn.Text = openDlg.FileName;
            }
        }

        private void button7_Click(object sender, EventArgs e)
        {
            openDlg.Title="选择平均气温数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Tempmean.Text = openDlg.FileName;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            openDlg.Title="选择太阳辐射数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Solar.Text = openDlg.FileName;
            }
        }

        private void button5_Click(object sender, EventArgs e)
        {
            openDlg.Title="选择相对湿度数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Hmd.Text = openDlg.FileName;
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择风速数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Wnd.Text = openDlg.FileName;
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择蒸散发数据文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Pet.Text = openDlg.FileName;
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择降雨站点文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox1_Pcp_station.Text = openDlg.FileName;
            }
        }

        private void button16_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择温度站点文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Temp_Station.Text = openDlg.FileName;
            }
        }

        private void button15_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择太阳辐射站点文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Solar_station.Text = openDlg.FileName;
            }
        }

        private void button14_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择相对湿度站点文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Hmd_station.Text = openDlg.FileName;
            }
        }

        private void button13_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择风速站点文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Wnd_station.Text = openDlg.FileName;
            }
        }

        private void button12_Click(object sender, EventArgs e)
        {
            openDlg.Title = "选择蒸散发站点文件";
            if (openDlg.ShowDialog() == DialogResult.OK)
            {
                this.textBox_Pet_station.Text = openDlg.FileName;
            }
        }

        private void ClimateFileSettingsDialog_Load(object sender, EventArgs e)
        {
            this.textBox_pcp.Text = HydroSimulate.g_ClimatePara.PcpInfo.DataFileName;
            this.textBox_Tempmx.Text = HydroSimulate.g_ClimatePara.TempmxInfo.DataFileName;
            this.textBox_Tempmn.Text = HydroSimulate.g_ClimatePara.TempmnInfo.DataFileName;
            this.textBox_Tempmean.Text = HydroSimulate.g_ClimatePara.TempmeanInfo.DataFileName;
            this.textBox_Solar.Text = HydroSimulate.g_ClimatePara.SlrInfo.DataFileName;
            this.textBox_Hmd.Text = HydroSimulate.g_ClimatePara.HmdInfo.DataFileName;
            this.textBox_Wnd.Text = HydroSimulate.g_ClimatePara.WndInfo.DataFileName;
            this.textBox_Pet.Text = HydroSimulate.g_ClimatePara.PetInfo.DataFileName;

            this.textBox1_Pcp_station.Text = HydroSimulate.g_ClimatePara.PcpInfo.StationFileName;
            this.textBox_Temp_Station.Text = HydroSimulate.g_ClimatePara.TempmxInfo.StationFileName;
            this.textBox_Solar_station.Text = HydroSimulate.g_ClimatePara.SlrInfo.StationFileName;
            this.textBox_Hmd_station.Text = HydroSimulate.g_ClimatePara.HmdInfo.StationFileName;
            this.textBox_Wnd_station.Text = HydroSimulate.g_ClimatePara.WndInfo.StationFileName;
            this.textBox_Pet_station.Text = HydroSimulate.g_ClimatePara.PetInfo.StationFileName;
        }
    }
}
